require 'active_resource'

# Define the proxy class
class Message < ActiveResource::Base
  self.site = 'http://localhost:7008'
end

message = Message.new
message.subject = "Howlr Test"
message.body = "This is just a test!"
message.from = "Test McTestski <test@example.foo>"
message.recipients = "John Doe <jdoe@example.foo>; Sally Smith <ssmith@example.foo>"
  
# Saving the message commits it to the server, causing the message to 
# be sent out.
message.save

# The server temporarily stores copies of all sent messages. Saving a  
# message (i.e. sending it) assigns to it a unique ID. We can use this 
# ID to later retrieve a copy of this message.
message2 = Message.find(message.id) 